package com.mercury.system.biz.controller;

import com.mercury.base.result.ResultVo;
import com.mercury.security.annotation.Inner;
import com.mercury.system.api.model.dto.UserAuthDto;
import com.mercury.system.api.model.entity.SysUser;
import com.mercury.system.biz.service.ISysUserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author mercury
 */
@RestController
@RequestMapping("/inner/users")
@Slf4j
@Api(tags = "用户模块")
public class UserController {

    @Resource
    private ISysUserService iSysUserService;

    /**
     * 获取用户信息
     */
    @Inner
    @GetMapping("/username")
    public ResultVo<UserAuthDto> getUserByUsername(@RequestParam("username") String username) {
        SysUser sysUser = iSysUserService.getByUsername(username);
        UserAuthDto userAuthDto = new UserAuthDto(sysUser);
        return ResultVo.ok(userAuthDto);
    }


}
